const MyPromise = require("../template.js")

/** 三、.then 链式调用测试 */
// 测试 then() 链式调用 以及值传递
function testThenChaining() {
  const promise = new MyPromise((resolve) => resolve(1))
  //
  promise
    .then((value) => new MyPromise((resolve) => resolve(value + 1)))
    .then((value) => value * 2)
    .then((value) => console.log("3.Chained value:", value === 4)) // 应打印 true
}

testThenChaining()
